package com.kede.app.domain;

import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @description /
* @author Pr.li
* @date 2023-06-06
**/
@Entity
@Data
@Table(name="t_supplie_store_log")
@EntityListeners(AuditingEntityListener.class)
public class SupplieStoreLog implements Serializable {
    /**
    * 
    */
    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 物资id
    */
    @ApiModelProperty(value = "物资id")
    @Column(name = "`supplie_id`",nullable = false)
    @NotNull
    private Integer supplieId;
    /**
    * 门店id
    */
    @ApiModelProperty(value = "门店id")
    @Column(name = "`store_id`",nullable = false)
    @NotNull
    private Integer storeId;
    /**
    * 这次门店入库多少
    */
    @ApiModelProperty(value = "这次门店入库多少")
    @Column(name = "`num`",nullable = false)
    @NotNull
    private Integer num;
    /**
    * 门店入库图片信息
    */
    @ApiModelProperty(value = "门店入库图片信息")
    @Column(name = "`img`",nullable = false)
    private String img;
    /**
    * 
    */
    @ApiModelProperty(value = "createTime")
    @Column(name = "`create_time`")
    @CreatedDate
    private Timestamp createTime;

    @ApiModelProperty(value = "门店信息")
    @Transient
    private ZhiUserCertified store;

    public void copy(SupplieStoreLog source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
